package com.authorization.project.single.service.impl;

import java.util.List;
import com.authorization.common.utils.DateUtils;
import com.authorization.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.authorization.project.single.mapper.SingleServiceMapper;
import com.authorization.project.single.domain.SingleService;
import com.authorization.project.single.service.ISingleServiceService;

/**
 * 单服务Service业务层处理
 * 
 * @author 李晓雷
 * @date 2020-07-11
 */
@Service
public class SingleServiceServiceImpl implements ISingleServiceService 
{
    @Autowired
    private SingleServiceMapper singleServiceMapper;

    /**
     * 查询单服务
     * 
     * @param id 单服务ID
     * @return 单服务
     */
    @Override
    public SingleService selectSingleServiceById(Long id)
    {
        return singleServiceMapper.selectSingleServiceById(id);
    }

    /**
     * 查询单服务列表
     * 
     * @param singleService 单服务
     * @return 单服务
     */
    @Override
    public List<SingleService> selectSingleServiceList(SingleService singleService)
    {
        return singleServiceMapper.selectSingleServiceList(singleService);
    }

    /**
     * 新增单服务
     * 
     * @param singleService 单服务
     * @return 结果
     */
    @Override
    public int insertSingleService(SingleService singleService)
    {
        singleService.setCreateBy(SecurityUtils.getUsername());
        singleService.setCreateTime(DateUtils.getNowDate());
        return singleServiceMapper.insertSingleService(singleService);
    }

    /**
     * 修改单服务
     * 
     * @param singleService 单服务
     * @return 结果
     */
    @Override
    public int updateSingleService(SingleService singleService)
    {
        singleService.setUpdateBy(SecurityUtils.getUsername());
        singleService.setUpdateTime(DateUtils.getNowDate());
        return singleServiceMapper.updateSingleService(singleService);
    }

    /**
     * 批量删除单服务
     * 
     * @param ids 需要删除的单服务ID
     * @return 结果
     */
    @Override
    public int deleteSingleServiceByIds(Long[] ids)
    {
        return singleServiceMapper.deleteSingleServiceByIds(ids);
    }

    /**
     * 删除单服务信息
     * 
     * @param id 单服务ID
     * @return 结果
     */
    @Override
    public int deleteSingleServiceById(Long id)
    {
        return singleServiceMapper.deleteSingleServiceById(id);
    }
}
